﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Cryptography;
using System.Text;

namespace Mewdam.Membership
{
    public class User
    {
        int id { get; set; }
        string Token { get; set; }
        string UserName { get; set; }
        string Password { get; set; }

        string encryptedTokenSecret;
        public string EncryptedTokenSecret
        {
            get
            {
                byte[] byteEncryptedData =
                    ProtectedData.Protect(
                        Encoding.ASCII.GetBytes(encryptedTokenSecret),
                        null,
                        DataProtectionScope.LocalMachine
                        );
                return Encoding.ASCII.GetString(byteEncryptedData);
            }
            set
            {
                byte[] byteEncryptedData =
                    ProtectedData.Protect(
                        Encoding.ASCII.GetBytes(value),
                        null,
                        DataProtectionScope.LocalMachine
                        );

                encryptedTokenSecret = Encoding.ASCII.GetString(byteEncryptedData); 
            }
        }

        string valetKey;
        public string ValetKey
        {
            get
            {
                return valetKey;
            }
            set 
            { 
                valetKey = value; 
            }
        }
        //DateTime expires;



    }
}
